import {createRouter, createWebHistory} from 'vue-router'
// 1. 导入路由组件
import HomeView from '../views/HomeView.vue'
import ShopView from "@/views/ShopView.vue";
import BookCaseView from "@/views/BookCaseView.vue";
import CartView from "@/views/CartView.vue";
import WareHouseView from "@/views/WareHouseView.vue";

// 2. 创建路由实例并传递 `routes` 配置
const router = createRouter({
    // 4. 内部提供了 history 模式的实现。
    history: createWebHistory(import.meta.env.BASE_URL),
    // 3. 定义一些路由，每个路由都需要映射到一个组件。
    // 默认情况下，所有路由是不区分大小写的，并且能匹配带有或不带有尾部斜线的路由。
    // 例如，路由 /users 将匹配 /users、/users/、甚至 /Users/。
    // 这种行为可以通过 strict 和 sensitive 选项来修改
    routes: [
        {
            path: '/',
            name: 'home',
            component: HomeView
        },
        {
            path: '/shop/',
            name: 'shop',
            component: ShopView
        },
        {
            path: "/bookcase/",
            name: 'bookcase',
            component: BookCaseView
        },
        {
            path: '/cart/',
            name: 'cart',
            component: CartView
        },
         {
            path: '/warehouse/',
            name: 'warehouse',
            component: WareHouseView
        }
        // {
        //     path: '/about',
        //     name: 'about',
        //     // route level code-splitting
        //     // this generates a separate chunk (About.[hash].js) for this route
        //     // which is lazy-loaded when the route is visited.
        //     component: () => import('../views/AboutView.vue')
        // }
    ]
})

export default router
